package com.iot.spi.controller;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON;
import com.iot.spi.core.IotClient;
import com.iot.spi.request.DemoRequest;
import com.iot.spi.request.WatchTrackSearchRequest;
import com.iot.spi.response.DemoResponse;
import com.iot.spi.response.Resp;
import com.iot.spi.response.WatchTrackSearchResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@RestController
public class DemoController {

    @Resource
    private IotClient client;

    @GetMapping("/test")
    public Object t1() {
        WatchTrackSearchRequest request = WatchTrackSearchRequest.builder()
                .productCode("WATCH")
                .deviceId("9620459474")
                .startTime("2024-10-10 11:17:10")
                .endTime("2024-10-30 11:17:10")
                .build();
        List<WatchTrackSearchResponse> s= new ArrayList<>();
        Resp<List<WatchTrackSearchResponse>> s1 = client.execute(request);
        log.info("{}",JSON.toJSONString(s1));
        return s1;
    }

}
